<template>
  <div class="message-page">
    <div class="message-title">消息管理</div>
    <el-table :data="messageData" style="width: 100%" border>
      <el-table-column prop="time" label="时间" width="180" />
      <el-table-column prop="student" label="学生" width="140" />
      <el-table-column prop="topic" label="课题名称" width="260" />
      <el-table-column prop="content" label="消息内容" />
      <el-table-column prop="status" label="状态" width="100">
        <template #default="scope">
          <el-tag :type="scope.row.status === '已读' ? 'success' : 'info'">{{ scope.row.status }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="100">
        <template #default="scope">
          <el-button v-if="scope.row.status === '未读'" type="primary" link size="small" @click="markRead(scope.row)">标为已读</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref } from 'vue'
const messageData = ref([
  { time: '2024-05-10 10:00', student: '李明', topic: '图书商城', content: '学生已完成开题报告。', status: '未读' },
  { time: '2024-05-09 15:30', student: '王芳', topic: '学生管理系统', content: '学生已提交论文初稿。', status: '已读' },
  { time: '2024-05-08 11:20', student: '张伟', topic: '基于java的鲜花商城系统的设计与实现', content: '学生已完成答辩。', status: '未读' }
])
function markRead(row) {
  row.status = '已读'
}
</script>

<style scoped>
.message-page {
  max-width: 1000px;
  margin: 40px auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 32px 32px 24px 32px;
}
.message-title {
  font-size: 26px;
  font-weight: bold;
  color: #409eff;
  margin-bottom: 32px;
}
</style>